// ----------------------------------
// RSDK Project: Sonic 1/Sonic 2
// Script Description: Decoration
// Script Author: Christian Whitehead/Simon Thomley
// Unpacked by Rubberduckycooly's script unpacker
// ----------------------------------

//-------Aliases-------//
private alias 28 : TYPE_DECORATION

event ObjectMain
	//General Movement
	object.xpos += object.xvel
	object.ypos += object.yvel

	//If lower then 4, actually do stuff. 4 and greater are blank
	if object.propertyValue <= 4
		object.value1 = object[0].ypos
		object.value1 -= 0x480000
		if object.ypos < object.value1
			barScore += 1
			object.type = TypeName[blank object]
		end if
			object.yvel = -0x10000
		else
			object.type = TypeName[blank object]
	end if	

	//Notes
	switch object.propertyValue
	case 0
		BoxCollisionTest(C_TOUCH, object.entityPos, 0, -15, 15, 0, SLOT_NOTES, 0, -15, 15, 0)	
		if checkResult == true
			if inputpress[0].left == 1
			//	PlaySfx(SfxName[Lamppost], false)
				barScore -= 1
				object.type = TypeName[Blank Object]
			end if
		end if
	break
	case 1

		BoxCollisionTest(C_TOUCH, object.entityPos, 20, -15, 30, 0, SLOT_NOTES, 20, -15, 30, 0)	
		if checkResult == true
			if inputpress[0].down == 1
			//	PlaySfx(SfxName[Lamppost], false)
				barScore -= 1
				object.type = TypeName[Blank Object]
			end if
		end if
	break	
	case 2
		
		BoxCollisionTest(C_TOUCH, object.entityPos, 33, -15, 45, 0, SLOT_NOTES, 33, -15, 45, 0)	
		if checkResult == true
			if inputpress[0].up == 1
			//	PlaySfx(SfxName[Lamppost], false)
				barScore -= 1
				object.type = TypeName[Blank Object]
			end if
		end if
	break	
	case 3
		

		
		BoxCollisionTest(C_TOUCH, object.entityPos, 47, -15, 65, 0, SLOT_NOTES, 47, -15, 65, 0)	
		if checkResult == true
			if inputpress[0].right == 1
			//	PlaySfx(SfxName[Lamppost], false)
				barScore -= 1
				object.type = TypeName[Blank Object]
			end if
		end if
	break		
	case 4
		object.type = TypeName[Blank Object]
	break
	end switch


end event


event ObjectDraw
	object.drawOrder = 5

	switch object.propertyValue
		case 0 
			DrawSpriteFX(0, FX_ROTATE, object.xpos, object.ypos)
		break
		case 1
			DrawSpriteFX(1, FX_ROTATE, object.xpos, object.ypos)
		break
		case 2
			DrawSpriteFX(2, FX_ROTATE, object.xpos, object.ypos)
		break
		case 3
			DrawSpriteFX(3, FX_ROTATE, object.xpos, object.ypos)
		break
	end switch	
	
end event


event ObjectStartup
	barScore = 0
	LoadSpriteSheet("3D_Test/Funkin.gif")
	SpriteFrame(0, -15, 17, 12, 1, 28)	//left
	SpriteFrame(19, -18, 12, 17, 20, 25)	//doown
	SpriteFrame(33, -18, 12, 17, 34, 25)	//up	
	SpriteFrame(47, -15, 17, 12, 48, 28)	//right	
end event

event RSDKDraw
	DrawSprite(0)
end event

event RSDKLoad
	LoadSpriteSheet("Global/Display.gif")
	SpriteFrame(-16, -16, 32, 32, 1, 143)
end event
